<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/materialdesignicons.min.css" rel="stylesheet">
    <link href="/css/animate.min.css" rel="stylesheet">
    <link href="/css/validate.css" rel="stylesheet">
    <link href="/css/style.min.css" rel="stylesheet">
    <link href="/js/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="/js/bootstrap-datepicker/bootstrap-datepicker3.min.css" rel="stylesheet">
    <link href="/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css" rel="stylesheet">
    <link href="/js/bootstrap-clockpicker/bootstrap-clockpicker.min.css" rel="stylesheet">

</head>
<body>

<!--新增模态框-->
<div class="container-fluid p-t-10">
    <div class="modal-dialog">
        <div class="modal-content">
            <form th:action="@{/emplist/updatepassword}" method="post" id="passwordform">
                <div class="modal-header">
                    <h4 class="modal-title">修改密码</h4>
                </div>

                <input id="update_id" class="form-control" type="hidden" placeholder="" name="update_id" th:value="${session.loginUser.id}">
                <input id="update_empno" class="form-control" type="hidden" placeholder="" name="update_empno" th:value="${session.loginUser.empno}">

                <div class="card-body">
                    <div class="form-group">
                        <label>原密码</label>
                        <input id="password" class="form-control" type="password" placeholder="请输入原密码" name="password">
                    </div>
                    <div class="form-group">
                        <label>新密码</label>
                        <input id="new_password" class="form-control" type="password" placeholder="请输入新密码" name="new_password">
                    </div>
                    <div class="form-group">
                        <label>确认新密码</label>
                        <input id="cheack_password" class="form-control" type="password" placeholder="请再次输入新密码" name="cheack_password">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-primary" >修改</button>
                </div>
            </form>
            <!--/*@thymesVar id="addmsg" type="String"*/-->
            <input type="hidden" id="msg" th:value="${msg}">

        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>



<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/popper.min.js"></script>
<script type="text/javascript" src="/js/bootstrap.min.js"></script>

<!--弹出框插件-->
<script type="text/javascript" src="/js/bootbox.min.js"></script>
<script type="text/javascript" src="/js/bootbox.locales.min.js"></script>

<!--表单验证插件-->
<script type="text/javascript" src="/js/jquery.validate.js" th:src="@{/js/jquery.validate.js}"></script>
<script type="text/javascript" src="/js/messages_zh.js" th:src="@{/js/messages_zh.js}"></script>


<script>
    //表单验证
    $().ready(function() {



        $("#passwordform").validate(
            {
                rules: {
                    password: "required",
                    new_password: {
                        required:true,
                        minlength:6,
                        maxlength:16
                    },
                    cheack_password: "required",

                },
                messages:{

                    password: "旧密码不能为空",
                    new_password: {
                        required:"密码不能为空",
                        minlength:"密码不能小于6个字符",
                        maxlength:"密码不能大于14个字符"
                    },
                    cheack_password: "重复密码不能为空"


                },

                errorElement: "em"

            }
        );



    });
</script>
<script type="text/javascript">
    onload=function(){
        var msg =  $("#msg").val();
        if(msg){
            bootbox.alert({message: msg,size:'small'});
            sessionStorage.clear();

        }
    };
</script>


</body>
</html>
